{include file='_header'}
<script type="text/javascript" src="__STATIC__/js/lib/moment.js"></script>
<link rel="stylesheet" href="__STATIC__/components/datetimepicker/jquery.datetimepicker.css">
<link rel="stylesheet" href="__STATIC__/components/daterangepicker/daterangepicker.css">
<div class="page-header">
    当前位置：<span class="text-primary">{$applytitle}申请</span>
</div>
<div class="page-content">
    <form action="" method="get" class="form-horizontal  table-search" role="form" id="form1">
        <input type="hidden" name="status" value="{$status}" />
        <div class="page-toolbar m-b-sm m-t-sm">
            <div class="pull-left">
                    {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
            </div>
            <div class="col-sm-6 pull-right">
                <div class="input-group">
                    <div class="input-group-select">
                        <select name='timetype'   class='form-control' >
                            <option value=''>不按时间</option>
                            {if $status>=1}<option value='applytime' {if $timetype=='applytime'}selected{/if}>申请时间</option>{/if}
                            {if $status>=2}<option value='checktime' {if $timetype=='checktime'}selected{/if}>审核时间</option>{/if}
                            {if $status>=3}<option value='paytime' {if $timetype=='paytime'}selected{/if}>打款时间</option>{/if}
                        </select>
                    </div>
                    <input type="text" class="form-control input-sm"  name="keyword" value="{$keyword}" placeholder="请输入申请单号"/>
                    <span class="input-group-btn">
                        <button class="btn btn-primary" type="submit"> 搜索</button>
                        <button type="submit" name="export" value="1" class="btn btn-success ">导出</button>
                    </span>
                </div>
            </div>
        </div>
    </form>
    {if count($list)>0}
    
    <?php $col=7;?>
    <table class="table table-hover">
        <thead class="navbar-inner">
            <tr>
                <th>申请单号</th>
                <th>申请金额<br>抽成后金额</th>
                {if $status > 1}
                <?php $col++;?>
                <th >通过申请金额<br>抽成后金额</th>
                {/if}
                {if $status == 3}
                <?php $col++;?>
                <th>实际打款金额</th>
                {/if}
                <th>抽成比例</th>
                <th>申请订单个数{if $status > 1}<br>通过申请订单个数{/if}</th>
                <th>提现方式</th>
                {if $status==-1}
                <?php $col++;?>
                <th>无效时间</th>
                {elseif $status>=3}
                <th>打款时间</th>
                {elseif $status>=2}
                <th>审核时间</th>
                {elseif $status>=1}
                <th>申请时间</th>
                {/if}
                <th style="width: 45px;">操作</th>
            </tr>
        </thead>
        <tbody>
        {foreach name='list' item='row'}
        <tr>
            <td>{$row['applyno']}</td>
            <td>{$row['realprice']}<br>{$row['realpricerate']}</td>
            {if $status > 1}
            <td>{$row['passrealprice']}<br>{$row['passrealpricerate']}</td>
            {/if}
            {if $status == 3}
            <td>{$row['finalprice']}</td>
            {/if}
            <td>{$row['payrate']}%</td>
            <td>{$row['ordernum']}{if $status > 1}<br>{$row['passordernum']}{/if}</td>
            <td>
                {if empty($row['applytype'])}
                <span><i class="icow icow-weixin text-success"></i> {$apply_type[$row['applytype']]}</span>
                {elseif $row['applytype']=='2'}
                <span> <i class="icow icow-zhifubaozhifu text-primary"></i>{$apply_type[$row['applytype']]}</span>
                {elseif $row['applytype']=='3'}
                <span><i class="icow icow-icon text-warning"></i>{$apply_type[$row['applytype']]}</span>
                {/if}
            </td>
            <td>
                {if $row['status']!=1}<a data-toggle='popover' data-content="
                             {if $status>=1 && $row['status']!=1}申请时间: <br/>{:date('Y-m-d',$row['applytime'])}<br/>{:date('H:i',$row['applytime'])}{/if}
                             {if $status>=2 && $row['status']!=2}<br/>审核时间: <br/>{:date('Y-m-d',$row['checktime'])}<br/>{:date('H:i',$row['checktime'])}{/if}
                             {if $status>=3 && $row['status']!=3}<br/>付款时间: <br/>{:date('Y-m-d',$row['paytime'])}<br/>{:date('H:i',$row['paytime'])}{/if}
                             {if $status==-1}<br/>无效时间: <br/>{:date('Y-m-d',$row['invalidtime'])}<br/>{:date('H:i',$row['invalidtime'])}{/if} " data-html="true" data-trigger="hover">{/if}
                {if $status>=1}
                {:date('Y-m-d',$row['applytime'])}<br/>{:date('H:i',$row['applytime'])}
                {elseif $status>=2}
                {:date('Y-m-d',$row['checktime'])}<br/>{:date('H:i',$row['applytime'])}
                {elseif $status>=3}
                {:date('Y-m-d',$row['paytime'])}<br/>{:date('H:i',$row['paytime'])}
                {elseif $status==-1}
                {:date('Y-m-d',$row['invalidtime'])}<br/>{:date('H:i',$row['invalidtime'])}
                {/if}
                {if $row['status']!=1}<i class="fa fa-question-circle"></i></a>{/if}
            </td>
            <td>
                <a class='btn btn-default btn-sm btn-op btn-operation' href="{:url('merch/apply/detail',array('id' => $row['id'],'status'=>$row['status']))}">
                    <span data-toggle="tooltip" data-placement="top" title="" data-original-title="查看详情">
                         <i class='icow icow-chakan-copy'></i>
                    </span>
                </a>
            </td>
        </tr>
        {/foreach}
        </tbody>
        <tfoot>
            <tr>
                <td colspan="{$col}" class="text-right">{$pager}</td>
            </tr>
        </tfoot>
    </table>
    {else}
    <div class='panel panel-default'>
        <div class='panel-body' style='text-align: center;padding:30px;'>
            暂时没有任何{$applytitle}申请申请!
        </div>
    </div>
    {/if}
</div>

{include file='_footer'}

